package com.ybu.service.impl;
import com.ybu.common.ServiceCode;
import com.ybu.common.ServiceException;
import com.ybu.mapper.ProductCategoryMapper;
import com.ybu.pojo.vo.ProductCategoryVO;
import com.ybu.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ProjectName: cmall-ybu
 * @Titile: ProductCategoryServiceImpl
 * @Author: Lucky
 * @Description: 商品分类业务实现类
 */
@Service
public class ProductCategoryServiceImpl implements ProductCategoryService {
    @Autowired
    private ProductCategoryMapper productCategoryMapper;
    @Override
    public List<ProductCategoryVO> getCategoryList() {
        List<ProductCategoryVO> categoryList = productCategoryMapper.getCategoryList();
        if(categoryList == null){
            throw new ServiceException(ServiceCode.ERR_NOT_FOUND,"没有商品分类信息");
        }
        return categoryList;
    }
}